package com.Controller;

import com.Service.BookshelfService;
import com.pojo.Bookshelf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.sql.SQLException;
import java.util.List;

@Controller
@RequestMapping("/bookshelf")
public class BookShelfController {
    @Autowired
    private BookshelfService bookshelfService;
    @PostMapping("add")
    @ResponseBody
    public int addToBookshelf(@RequestBody Bookshelf bookshelf) throws SQLException {
     return bookshelfService.addToBookshelf(bookshelf);
    }
    @GetMapping("/getMyBook")
    @ResponseBody
    public List<Bookshelf> getMyBook(@RequestParam String username) throws SQLException {
       return   bookshelfService.getMyBook(username);
    }
}
